<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/easyui/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/easyui/themes/icon.css">
    <script type="text/javascript" src="${pageContext.request.contextPath}/easyui/jquery.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript"  src="${pageContext.request.contextPath}/easyui/easyui-lang-zh_CN.js"></script>
<meta http-equiv="Content-Type" content="/text/html; charset=UTF-8">
<title>企业库存管理系统登录页面</title>
<style type="text/css">
body {background-image:url("image/001.jpg");}
        html, body
        {
            width: 100%;
            height: 100%;
            margin: 0;
            padding: 0;
        }

        h1
        {
            color: rgb(128, 128, 128);
            text-align: center;
        }

        a:link, a:hover, a:visited, a:active
        {
            color: rgb(128, 128, 128);
            text-decoration: none;
        }

        .form1
        {
            width: 400px;
            min-width: 400px;
            position: absolute;
            left: 40%;
            top: 15%;
            margin: 0;
            padding: 30px;
            background-color: white;
            border: 2px solid rgba(128, 128, 128, 0.2);
            border-radius: 10px;
        }
        
        form div
        {
            margin-bottom: 10px;
        }
    </style>
    <script type="text/javascript">
	function login(){
		var userName=document.getElementById("userName").value;
		var password=document.getElementById("password").value;
		var roleName=document.getElementById("roleName").value;
		if(userName==null||userName==""){
			alert("用户名不能为空！");
			return;
		}
		if(password==null||password==""){
			alert("密码不能为空！");
			return;
		}
		if(roleName==null||roleName==""){
			alert("请选择用户类型！");
			return;
		}
		$("#adminlogin").submit();			
	}

	<!--添加新用户-->
	function openAddDialog(){
		var id3=document.getElementById("id").value;
		$("#dlg").dialog("open").dialog("setTitle","注册新用户");
		url="${pageContext.request.contextPath}/updatestaff.do?id2="+id3;
	}
	function add(){
		$("#fm").form("submit",{
			url:url,
			onSubmit:function(){
				var mobile=/^1[3|4|5|8][0-9]\d{8}$/;
				var b8=document.getElementById("number");
				var bb8=b8.value;
				var password1=document.getElementById("password1").value;
				var password2=document.getElementById("password2").value;
				if(!mobile.test(bb8))
					{
					$.messager.alert("系统提示","手机格式有误");
					return false;
					}
                  if(password1!=password2)
                	  {
                	  $.messager.alert("系统提示","两次密码不一致!");
  					return false;
                	  
                	  }
				
				
				return $(this).form("validate");
			},
			success:function(result){
				var result=eval('('+result+')');
				if(result.success){
					$.messager.alert("系统提示","保存成功");
					resetValue();
					$("#dlg").dialog("close");
					$("#dg").datagrid("reload");
				}else{
					$.messager.alert("系统提示","保存失败");
					return;
				}
			}
		});
	}
	
	
	
	function resetValue(){
		$("#id").val("");
		$("#name").val("");
		$("#password1").val("");
		$("#password2").val("");
		$("#number").val("");
		$("#address").val("");
		$("#remark").val("");
		
	}
	
	function closeDialog(){
		$("#dlg").dialog("close");
		resetValue();
	}
	</script>
</head>
<body>

     <!-- 用户登录 -->
    <form action="${pageContext.request.contextPath}/login.do" method="post" id="adminlogin"
	name="adminlogin" class="form1">
    <div>
        <h1>用户登录</h1>
    </div>
    <div>
        <input class="easyui-textbox" data-options="iconCls:'icon-man',iconWidth:30,iconAlign:'left',prompt:'用户名'" value="李四"  style="width:100%;height:35px;" required=true name="userName" id="userName"/>
    </div>
    <div>
        <input class="easyui-passwordbox" data-options="iconWidth:30,iconAlign:'left',prompt:'密码'" value="123456" style="width:100%;height:35px;" required=true name="password" id="password"/>
    </div>
    <div >
        <select class="easyui-combobox" style="width: 335px" name="roleName" id="roleName">
            
            <option value="超级管理员">超级管理员</option>
            <option value="普通管理员">普通管理员</option>
            
        </select>
    </div>

    <div>
        <input class="easyui-checkbox" label="记住密码" labelPosition="after" labelWidth="70" />
    </div>
    <div>
        <input class="easyui-linkbutton c1" type="submit" value="登陆" style="width:100%;height:35px;" onclick="javascript:login();return false;"/>
    </div>
    <div>
        <div style="display:inline;">
           <a href="javascript:openAddDialog()" class="easyui-linkbutton"  plain="true">还没注册?</a>
        </div>
        <div style="display:inline;margin-left:170px;">
            <a href="javascript:openforgetPasswordDialog()" class="easyui-linkbutton"  plain="true">忘记密码？</a>
        </div>
    </div>
    </form>
    
    
    <!-- 注册 -->
	<div id="dlg" class="easyui-dialog" style="width: 400px;height:400px;padding: 10px 20px"
	  closed="true" buttons="#dlg-buttons">
	 	<form id="fm" method="post">
	 		<table cellspacing="8px">
	 		<tr>
	 		<!-- name的属性值与实体中的要一致 -->
	 				<td>员工编号：</td>
	 				<td><input type="text" id="id" name="id" class="easyui-validatebox" required=true/>&nbsp;<font color="red">*</font></td>
	 			</tr>
	 			
	 			<tr>
	 				<td>员工姓名：</td>
	 				<td>
	 					<input type="text" id="name" name="userName" class="easyui-validatebox" required=true/>&nbsp;<font color="red">*</font>
	 				</td>
	 				</tr>
	 				<tr>
	 				<td>手机号码：</td>
	 				<td>
	 					<input type="text" id="number" name="telephone" class="easyui-validatebox" required=true/>&nbsp;<font color="red">*</font>
	 				</td>
	 			</tr>
	 			<tr>
	 			<td>密码：</td>
	 				<td>
	 					<input type="password" id="password1" name="password" class="easyui-validatebox" required=true/>&nbsp;<font color="red">*</font>
	 				</td>
	 			</tr>
	 			
	 			<tr>
	 			<td>确认密码：</td>
	 				<td>
	 					<input type="password" id="password2" name="password2" class="easyui-validatebox" required=true/>&nbsp;<font color="red">*</font>
	 				</td>
	 			</tr>
	 				<tr>
	 				<td>地址：</td>
	 				<td>
	 					<input type="text" id="address" name="address" class="easyui-validatebox" required=true/>&nbsp;<font color="red">*</font>
	 				</td>
	 				</tr>
	 				<tr>
	 				<td>备注：</td>
	 				<td>
	 					<input type="text" id="remark" name="remark" class="easyui-validatebox" required=true/>&nbsp;<font color="red">*</font>
	 				</td>
	 				</tr>
	 			<tr>
	 			
	 				<td>角色：</td>
	 				<td>
	 					<input type="text" id="roleName" name="roleName" class="easyui-validatebox" value="普通管理员":/>&nbsp;<font color="red">*</font>
	 				</td>
	 				</tr>
	 		</table>
	 			
	 	</form>
	</div>

	<div id="dlg-buttons">
		<a href="javascript:add()" class="easyui-linkbutton" iconCls="icon-ok">保存</a>
		<a href="javascript:closeDialog()" class="easyui-linkbutton" iconCls="icon-cancel">关闭</a>
	</div>
 
 
 
 
<script type=text/javascript>
	if('${errorMsg}'!=''){
		alert('${errorMsg}');
	}
	</script>
</body>
</html>